<template>
	<section class="monthly">
		<div class="printing">
			<div class="printing-item" v-for="(item, index) in printArr" :key="index">
				<span v-show="!is_img">{{item}}</span>
				<img :src="item" v-show="is_img">
			</div>
		</div>
	</section>
</template>

<script>
	export default {
		data() {
			return {
				printArr: [],
				is_img: false,
			}
		},
		methods: {
            doPrinting() {
                var bdhtml = window.document.body.innerHTML;
                window.document.body.innerHTML = bdhtml;
                window.print();
                window.document.body.innerHTML = bdhtml;
            }
		},
		mounted() {
			if(this.$route.query.img){
				this.is_img = true;
			}
			this.printArr = sessionStorage.getItem('printing').split('*');
			setTimeout(() => {
				this.doPrinting()
			}, 1000)
		}
	}

</script>


<style>
.printing{
	padding: 20px;
}
.printing .printing-item{
	margin-bottom: 20px;
}
.printing img{
	width: 100%;
}
</style>